Namespace DataStream
    ''' <summary>
    ''' Exception class to indicate that the CalculatorObject
    ''' failed to parse, the string and the position it failed at
    ''' is passed as arguments to the exception
    ''' </summary>
    ''' <remarks></remarks>
    Public Class StreamCalculatorObjectParseException
        Inherits System.Exception

        Private mString As String
        Private mPosition As Integer
        Private mAdditional As String

        Sub New(ByVal EvalString As String, ByVal Position As Integer, Optional ByVal Additional As String = "")
            mString = EvalString
            mPosition = Position
            If Additional <> "" Then
                mAdditional = " : " & Additional
            End If
        End Sub

        Public ReadOnly Property Description() As String
            Get
                Dim tmp As String = mString.Substring(0, mPosition) & "^" & mString.Substring(mPosition)
                Return String.Format("The following Evalulation string: '{0}' failed at position: (^){1}{2}", tmp, mPosition, mAdditional)
            End Get
        End Property


    End Class

End Namespace
